package com.base.controller;

import com.base.po.voip.Sotreadv;
import com.base.service.ShopClassifyService;
import com.base.service.SotreadvService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * 店铺分类管理服务端
 *
 * @author f
 */
@Controller
@RequestMapping("/admin")
public class index_ShopClassify {

    @Autowired
    private ShopClassifyService shopClassifyService; // 分类信息

    // 分类广告首页
    @RequestMapping("/shopClassifyIndex")
    public ModelAndView shopClassifyIndex(HttpServletRequest request) {
        String userid = (String) request.getSession().getAttribute("adminUserId"); // 登录的用户ID
        if (userid == null) return new ModelAndView("jsp/loginCheck"); // 未登录
        return new ModelAndView("jsp/index_ShopClassify", "sClassifyList", shopClassifyService.selectByAll(userid));
    }

    // 跳转添加分类
    @RequestMapping("/addShopClassify")
    public String addShopClassify() {
        return "jsp/add_ShopClassify";
    }

    // 跳转修改分类
    @RequestMapping("/updateShopClassify")
    public ModelAndView updateShopClassify(String id) {
        return new ModelAndView("jsp/update_ShopClassify", "sClassify", shopClassifyService.selectByPrimaryKey(id));
    }
}
